package com.falser.user.controller;

import com.falser.common.web.ApiResponse;
import com.falser.user.service.FileService;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import java.io.IOException;

@RestController
@RequestMapping("/api/file")
public class FileController {

    private final FileService fileService;

    public FileController(FileService fileService) {
        this.fileService = fileService;
    }

    @PostMapping("upload")
    public ApiResponse upload(MultipartFile file) throws IOException {
        return ApiResponse.ofSuccess(fileService.upload(file));
    }
}
